package org.openstreetmap.gui.jmapviewer;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.geom.Line2D;

/**
 * Created by: Eduardo Quintana Contreras
 * Date: 4/07/12
 * Time: 04:47 PM
 */
public class MapTrack {
	private double lat1, lat2;
	private double lon1, lon2;
	private Color color;
	private float[] thicknesses = new float[]{1f, 3f, 5f, 7f};
	private int thickness;

	public MapTrack(double lat1, double lon1, double lat2, double lon2, Color color, int thickness) {
		this.color = color;
		this.lat1 = lat1;
		this.lon1 = lon1;
		this.lat2 = lat2;
		this.lon2 = lon2;
		this.thickness = thickness;
	}

	public double getLat1() {
		return lat1;
	}

	public double getLon1() {
		return lon1;
	}

	public double getLat2() {
		return lat2;
	}

	public double getLon2() {
		return lon2;
	}


	public void paint(Graphics g, Point position1, Point position2) {
		Graphics2D g2 = (Graphics2D) g;
		g2.setColor(color);
		g2.setStroke(new BasicStroke(thicknesses[thickness], BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
		g2.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
		g2.draw(new Line2D.Float(position1.x, position1.y, position2.x, position2.y));
	}
}
